﻿@model pbvs.Calculations.Valuation

@{
    ViewBag.Title = "Calculation";
}

<h2>Calculation Results</h2>

@if (ViewBag.error){
    <text>
        Something Went Wrong.  Sorry About that I will look into this error and fix it.

        Report this to me.  Tell me which request this was, and this error: <strong>@ViewBag.Message</strong><br />

        @Html.ActionLink("Go Back To Form", "Index", "Valuation") 
    </text>
} else {

<h1>Calculation Results For @Model.Request.ParticipantFirstName @Model.Request.ParticipantLastName</h1>    
<table>
    <tr>
        <td>Projection Year</td>
        <td>2022</td>
    </tr>
    <tr>
        <td>
            1994 UP Male ^ Scale AA Male(2022)<br />
            1994 UP Female ^ Scale AA Female(2022)
        </td>
    </tr>
    <tr>
        <td>Participant Gender:</td>
        <td>@Model.Request.Gender</td>
    </tr>
    <tr>
        <td>Interest for first 20 years</td>
        <td>@Model.Interest20Year</td>
    </tr>
    <tr>
        <td>Interest thereafter</td>
        <td>@Model.InterestThereafter</td>
    </tr>
    <tr>
        <td>First "n" Years</td>
        <td>@Model.FirstNYears</td>
    </tr>
    <tr>
        <td>Val Date</td>
        <td>@Model.Request.ValuationDate.ToShortDateString()</td>
    </tr>
    <tr>
        <td>DOB</td>
        <td>@Model.Request.Dob.ToShortDateString()</td>
    </tr>
    <tr>
        <td>Monthly life annuity benefit</td>
        <td>@string.Format("{0:c}", @Model.Request.BenefitAtRetirement)</td>
    </tr>
    <tr>
        <td>Retirement Date</td>
        <td>@Model.Request.RetirementDate.ToShortDateString()</td>
    </tr>
    <tr>
        <td>Retirement Age</td>
        <td>@Model.RetirementAge</td>
    </tr>
    <tr>
        <td>COLA</td>
        <td>@Model.Request.Cola</td>
    </tr>
    <tr>
        <td>Date of Marriage</td>
        <td>@Model.Request.MarriageDate.ToShortDateString()</td>
    </tr>
    <tr>
        <td>Date of Hire</td>
        <td>@Model.Request.Doh.ToShortDateString()</td>
    </tr>
    <tr>
        <td>Date of Termination</td>
        <td>@Model.Request.Dot.ToShortDateString()</td>
    </tr>
    <tr>
        <td>Total Benefit Service</td>
        <td>@Model.TotalBenefitService</td>
    </tr>
    <tr>
        <td>Attained Age</td>
        <td>@Model.AttainedAge</td>
    </tr>
    <tr>
        <td>Retirement Age:</td>
        <td>@Model.RetirementAge</td>
    </tr>
    <tr>
        <td>Deferred and Temporary Life Annuity Function</td>
        <td>mnax function - @Model.DeferredAndTemporaryLifeAnnuity</td>
    </tr>
    <tr>
        <td>Life Annuity Function</td>
        <td>
            nax function - @Model.LifeAnnuityNax<br />
            Dx Functions - @Model.LifeAnnuityGx1<br />
                           @Model.LifeAnnuityGx2
        </td>
    </tr>
    <tr>
        <td>Adjusted ax function</td>
        <td>@Model.AdjustedAx</td>
    </tr>
    @if (Model.Request.CalculateMarriage) {
        <tr>
            <td>Coverture Fraction:</td>
            <td>@Model.CovertureFraction</td>
        </tr>
        <tr>
            <td>Married Service</td>
            <td>@Model.MarriageService</td>
        </tr>
    }
	<tr>
		<td>Total Service</td>
		<td>@Model.TotalBenefitService</td>
	</tr>
	@if (Model.Request.Survivorship)
	{
		<tr>
			<td>Last-Survivor Annuity</td>
			<td>@Model.LastSurvivorAnnuity</td>
		</tr>
		<tr>
			<td>Survivor Attained Age</td>
			<td>@Model.SurvivorAttainedAge</td>
		</tr>
		<tr>
			<td>Case 1-RA-AA<20 years</td>
		</tr>
		<tr>
			<td>nEx</td>
			<td>@Model.ShortTermDeferredEndowment</td>
		</tr>
		<tr>
			<td>LSAn</td>
			<td>@Model.LastSurvivorAnnuity</td>
		</tr>
		<tr>
			<td>nLSA</td>
			<td>@Model.LastSurvivorAnnuityNYears</td>
		</tr>
	}
    <tr>
        <td>COLA Adjustment</td>
        <td>@Model.ColaAdjustment</td>
    </tr>
    <tr>
        <td>Interest Adjustment</td>
        <td>@Model.InterestAdjustment</td>
    </tr>
	@if (Model.Request.Survivorship)
	{
		<tr>
			<td>Case 1 Factor</td>
			<td>@Model.Case1Factor</td>
		</tr>
		<tr>
			<td>Case 2-RA-AA>=20 years</td>
		</tr>
	}
		<tr>
			<td>nEx</td>
			<td>@Model.LongTermDeferredEndowment</td>
		</tr>
		<tr>
			<td>nEx2</td>
			<td>@Model.LongTermDeferredEndowment2</td>
		</tr>
	@if (Model.Request.Survivorship)
	{
		<tr>
			<td>Case 2 Factor</td>
			<td>@Model.Case2Factor</td>
		</tr>
	}
	<tr>
        <td>Final Life annuity factor</td>
        <td>@Model.FinalLifeAnnuityFactor</td>
    </tr>
    <tr>
        <td>Present value of benefit at @Model.Request.ValuationDate.ToShortDateString()</td>
        <td>@string.Format("{0:c}",Model.PresentValueAtProjectedDate)</td>
    </tr>
    @if (Model.Request.CalculateMarriage){
        <tr>
            <td>Coverture Fraction</td>
            <td>@Model.CovertureFraction</td>
        </tr>
        <tr>
            <td>Marital Portion of present value at @Model.Request.ValuationDate.ToShortDateString()</td>
            <td>@string.Format("{0:c}", Model.MaritalPortionOfPresentValue)</td>
        </tr>
    }
    @if (Model.Request.Survivorship)
    {
        <tr>
            <td>Join & Survivor Final Factor</td>
            <td>@Model.JointSurvivorFinalFactor</td>
        </tr>
        <tr>
            <td>Survivorship Portion of PV</td>
            <td>@string.Format("{0:c}", Model.SurvivorshipPortionOfPresentValue)</td>
        </tr>
    }
</table>
<button onclick="history.go(-1);">Back</button>
<button id="pdf">View Letter</button>
<script type="text/javascript">
    $("#pdf").click(function () {
        window.open("@Url.Action("GetValuationPdf",new { reqId = Model.Request.Id })");
    });
</script>}